<?
$out=array();
if (!empty($images)){
	foreach ($images as $image){
		$values=array();
		$values=$image->toArray();
		$img=$image->getResizedObject($width, $height, true, true);
		if (!empty($img)){
			$values=array_merge($values, array(
				"path" => $img->getPublicPath(),
				"name" => $image->getName(),
				"description" => $image->getDescription(),
				"width" => $img->getWidth(),
				"height" => $img->getHeight()
			));
		}

		$out[]=$values;
	}
}

echo json_encode($out);